import React,{createContext} from 'react'

const NumContext = createContext()

function Child(){
	return (
		<NumContext.Consumer>
			{
				(num)=>{
					return <h2>ni{num}</h2>
				}
			}
		</NumContext.Consumer>
	)
}

export default class Setting extends React.Component {
	
constructor(props){
	super(props);
	this.state={
		num:0
	}
}
 render(){
	return (
		<NumContext.Provider value={this.state.num}>
				<Child/>
		</NumContext.Provider>
  
	)
 }

}
